<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>聚优惠</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/fontUtils.js"></script>
<script type="text/javascript" src="js/tagUtils.js"></script>
<script type="text/javascript" src="js/header&footer.js"></script>
<script type="text/javascript" src="js/font.js"></script>
<script type="text/javascript" src="js/openId1.js"></script>
<script type="text/javascript" src="js/qmsk-1.2.js"></script>
<script type="text/javascript">
/* var pagecount = 0; */
var paramStr=location.search;
var openId;
var shopId ;
$(function() {
	openId = _openId;
	shopId = _shopId;
	InitTable(0,openId,shopId);
	/*  $("#pager").pager({ pagenumber: 1, pagecount: pagecount, buttonClickCallback: PageClick }); */
});

/* PageClick = function(pageclickednumber) {
    $("#pager").pager({ pagenumber: pageclickednumber, pagecount: pagecount, buttonClickCallback: PageClick });
    $("#result").html("Clicked Page " + pageclickednumber);
	InitTable(pageclickednumber,openId,shopId);
} */

function getBoxHtml(data){
	if(IsEmpty(data)){
		return;
	}
	var parent= $(".wrapper");
	//var box1 = parent.children("div").eq(1);
	//var box2 = parent.children("div").eq(2);
	var box1=$("#box1");
	var box2=$("#box2");
	//box1.empty();
	//box2.empty();
	var rst = JSON.parse(data);
	if(rst.result.data.length==0){
		$("#noResult").show()
	}else{
		$("#noResult").hide()

	}
/* 	if(rst.result.len > 0){
		 var shu = rst.result.len;
	 	 pagecount = Math.ceil(shu/10);
	} */
	var shopName = null;
	var coupNo = null;
	var faceValue = null;
	var unffecDate = null;
	var status = null;
	var boxHtml = "";
	var memo
	for(var i=0;i<rst.result.data.length;i++){
		status = getHeadIndexValue(i,rst,"Status");
		shopName = getHeadIndexValue(i,rst,"shopName");
		coupNo = getHeadIndexValue(i,rst,"CouponNo");
		faceValue = getHeadIndexValue(i,rst,"FaceValue");
		unffecDate = getHeadIndexValue(i,rst,"UneffectDate");		
		memo = getHtmlString( getHeadIndexValue(i,rst,"memo"));		
		if(IsNotEmpty(status) && status == 0){
			boxHtml = " <div class='card'>"
				+"<div class='card_title'>"
				+"<h2><a>"+getHtmlString(shopName)+"</a></h2>"
				+" <span>"+getHtmlString(coupNo)+"</span></div>"
				+"<div class='fc'></div>"
				+"<div class='dolor'><span>代金券</span><span class='rainbows' gradToColor='#b16301'>"+getHtmlInt(faceValue)+"</span><span>元</span></div>"
				+"<p class='Rules'>"+memo+"</p>"
				+"<p class='Rules late_date'>"+getHtmlString(unffecDate).substring(0,10)+"</p>"
				+" <strong class='bg'><img src='images/small3.png' ></strong></div>";
			box1.append(boxHtml);
		}else{
			boxHtml = " <div class='card'>"
				+"<div class='card_title'>"
				+"<h2><a>"+getHtmlString(shopName)+"</a></h2>"
				+" <span>"+getHtmlString(coupNo)+"</span></div>"
				+"<div class='fc'></div>"
				+"<div class='dolor'><span>代金券</span><span class='rainbows' gradToColor='#b16301'>"+getHtmlInt(faceValue)+"</span><span>元</span></div>"
				+"<p class='Rules'>"+memo+"</p>"
				+"<p class='Rules late_date'>"+getHtmlString(unffecDate).substring(0,10)+"</p>"
				+" <strong class='bg'><img src='images/small3-3.png' ></strong></div>";
			box2.append(boxHtml);
		}
	}
	groupBox();
	initGradients('.rainbows');
}

function InitTable(pageIndex,openId,shopId) {
	$.ajax({
		type : "post",
		async: false,
		data :{"openId":openId},
		datatype : "json",
		url : "../memberConpDt/find/memberConpDt/shopId/"+shopId+"/" + pageIndex + "/1000",
		success : function(data) {
			if(IsNotEmpty(data)){
				
				getBoxHtml(data);
			}
		}
	});
}

</script>
</head>

<body>
<div class="wrapper">
    <div class="container" id="box">
        <div class="placeTit"><a class="back" href="javascript:history.go(-1)"></a>聚优惠</div>
  	<div id="tab"><span class="focus">未使用</span><span>已使用</span></div>
  	<div id="box1" class="box">
 	<!-- <div class="card">
    	<div class="card_title">
        	<h2><a href="javascript:void(0)"><img src="images/logo2.png" >老茶树石锅椒香鱼</a></h2>
            <span>NO.02130</span>
        </div>
        <div class="fc"></div>
      <div class="dolor"><span>代金券</span><span class="rainbows" gradToColor="#b16301">100</span><span>元</span></div>
      <p class="Rules">1、在本店享受鱼类，菜品8.8折</p>
      <p class="Rules">2、新品养生绝代双椒锅底原价38.特价18元！</p>
      <p class="Rules">3、黄辣丁，三角蜂，红鲨，6.8折大优惠！</p>
      <p class="Rules late_date">有效期至2013年12月9日</p>
        <strong class="bg"><img src="images/small3.png" ></strong>
    </div>  -->
    </div>
    
    
  	<div id="box2" class="box">
  	<!-- <div class="card">
    	<div class="card_title">
        	<h2><a href="javascript:void(0)"><img src="images/logo2.png" >5100有限公司</a></h2>
            <span>NO.02130</span>
        </div>
        <div class="fc"></div>
      <div class="dolor"><span>代金券</span><span class="rainbows" gradToColor="#b16301">100</span><span>元</span></div>
      <p class="Rules">1、在本店享受鱼类，菜品8.8折</p>
      <p class="Rules">2、新品养生绝代双椒锅底原价38.特价18元！</p>
      <p class="Rules">3、黄辣丁，三角蜂，红鲨，6.8折大优惠！</p>
      <p class="Rules late_date">有效期至2013年12月9日</p>
        <strong class="bg"><img src="images/small3-3.png" ></strong>
    </div>
  	<div class="card">
    	<div class="card_title">
        	<h2><a href="javascript:void(0)"><img src="images/logo2.png" >5100有限公司</a></h2>
            <span>NO.02130</span>
        </div>
        <div class="fc"></div>
      <div class="dolor"><span>代金券</span><span class="rainbows" gradToColor="#b16301">90</span><span>元</span></div>
      <p class="Rules">1、在本店享受鱼类，菜品8.8折</p>
      <p class="Rules">2、新品养生绝代双椒锅底原价38.特价18元！</p>
      <p class="Rules">3、黄辣丁，三角蜂，红鲨，6.8折大优惠！</p>
      <p class="Rules late_date">有效期至2013年12月9日</p>
        <strong class="bg"><img src="images/small3-3.png" ></strong>
    </div>  -->
    
    </div>
    		<div id="noResult" style="height: 265px; width: 100%; background: url(images/sale.jpg) no-repeat center 62px #f6f6f6; text-align: center;">
			<P style="padding-top: 150px; font-family: Microsoft YaHei; color: #cdcdcd; font-size: 16px;">暂时没有优惠券</P>
		</div>

    </div>
</div>
</body>
</html>
